package com.example.painting;

import android.graphics.Color;
import android.graphics.PorterDuff;
import android.os.Bundle;
import android.widget.Button;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Button button = findViewById(R.id.button);
        button.setOnClickListener(view -> {
            CustomView customView = findViewById(R.id.customView);
            //清空路径列表
            if(!customView.listStrokes.isEmpty()){
                customView.listStrokes.clear();
            }
            //清空画布
            customView.memCanvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
        });
    }
}